
		var validUserName = false;
		var validpwd = false;
		var validrpwd=false;
		var validEmail = false;
		var isValid = false;
		//通用的用户名验证方法
		var userNameCheck = function(obj){
	 		var inputID = obj.data.inputID;
	     	var mvpID = obj.data.mvpID;
	     	var messageID = obj.data.messageID;
	     	var vkey=$('#vKey').val();
       	 	var vValue=$('#vValue').val();
	    	var myreg=/^[a-zA-Z|\u4e00-\u9fa5]+[\u4e00-\u9fa5\w\d]+$/
        	if($('#'+inputID).val() == "" || $('#'+inputID).val().length == 0){
            	showMessage(messageID,"用户名不能为空",'red');
           		validUserName = false; 
            	return false;
        	}
       		if(lenReg($('#'+inputID).val()) < 4 || lenReg($('#'+inputID).val()) > 20){
            	showMessage(messageID,"用户名只能为4~20个字符,一个汉字为两个字符",'red');
            	validUserName = false;
           		return false;
       		}
               
           	if(mvpID) {
	         	if($('#'+inputID).val() == $('#'+mvpID).val()) {
	           		validUserName = true;
	           		showMessage(messageID,"","green");
		          	return true;
		     	}
	      	}
	           
       		if(!myreg.test($('#'+inputID).val())){
           		showMessage(messageID,"以中、英文开头，与数字、下划线组成",'red');
               	validUserName = false;
              	return false;
         	}
  			$.ajax({
				type: "POST",
				url: "/CASServer/custom/checkUidUniqueAjax.do",
				data: "uid="+$('#'+inputID).val()+"&"+vkey+"="+vValue,
				success: function(msg){
					var obj = eval("("+msg+")");
				    if(obj.isOk == 1){
				   		showMessage(messageID,obj.message,'red');
						validUserName = false;
					}else if (obj.isOk == 2){
						showMessage(messageID,obj.message,'red');
				  		validUserName = false;
					}else{
				  		showMessage(messageID,"用户名可用","green");
				  		validUserName = true;
					}
					$('#vKey').attr("value",obj.CASCheckKey);
					$('#vValue').attr("value",obj.CASCheckVale);
				}   
			});
			isValid = true;
		}
       
       	//new一个普通用户并绑定普通用户用户名验证方法
       	var userObj = new Object();
       	userObj.inputID = 'username';
       	userObj.messageID = 'user_message';
       	$("#username").bind("blur",userObj,userNameCheck );
       
		//new一个手机用户并绑定手机用户用户名的验证方法
		var mobileUserObj = new Object();
		mobileUserObj.inputID = 'mobileusername';
       	mobileUserObj.messageID = 'mobile_user_message';
       	$("#mobileusername").bind("blur",mobileUserObj,userNameCheck );
       
		//new一个mvp卡用户并绑定消费卡用户用户名的验证方法
		var userCarObj = new Object();
		userCarObj.inputID = 'uName';
		userCarObj.messageID = 'user_card_message';
		userCarObj.mvpID = 'mvpCard';
		$("#uName").bind("blur",userCarObj,userNameCheck );
       
       //new一个线下卡用户并绑定消费卡用户用户名的验证方法
       var offuserCarObj = new Object();
       offuserCarObj.inputID = 'offline_card_username';
       offuserCarObj.messageID = 'offline_card_user_message';
       $("#offline_card_username").bind("blur",offuserCarObj,userNameCheck );
       
      //通用的密码验证
        var pwdCheck = function(obj){
	     	var inputID = obj.data.inputID;
	    	var messageID = obj.data.messageID;
	          
	    	var lrtrim=/^\s+|\s+$/g;
	     	if(lrtrim.test($('#'+inputID).val())){
	   			showMessage(messageID,"密码前后不能有空格",'red');
	   			validpwd = false;
           		return false;
			}
	 
      		if($('#'+inputID).val() == "" || $('#'+inputID).val().length == 0){
            	showMessage(messageID,"密码不能为空",'red');
           		validpwd = false;
            	return false;
       		}else if($('#'+inputID).val().length < 6 || $('#'+inputID).val().length > 16){
	        	showMessage(messageID,"密码长度只能为6~16",'red');
	          	validpwd = false;
	          	return false;
     		}else if($('#r'+inputID).val() != "" && $('#r'+inputID).val().length != 0 
       			&& $('#'+inputID).val() != $('#r'+inputID).val()){
               	showMessage(messageID,"",'green'); 
             	showMessage("r"+messageID,"两次密码不相同",'red'); 
               	validrpwd = false;
             	validpwd = true; 
            	return false;
          	}else if($('#r'+inputID).val() != "" && $('#r'+inputID).val().length != 0 
            	&& $('#'+inputID).val() == $('#r'+inputID).val()){
             	showMessage(messageID,"",'green'); 
               	showMessage("r"+messageID,"",'green');
               	validrpwd = true; 
              	validpwd = true;
              	return false;
           	}
            
        	validpwd = true;
      		showMessage(messageID,"",'green');
      		return true;
		}
       
        //new一个普通用户并绑定普通用户密码的验证方法  
      	var userpwdObj = new Object();
    	userpwdObj.inputID = 'password';
     	userpwdObj.messageID = 'pwd_message';
		$("#password").bind("blur",userpwdObj,pwdCheck );
       
        //new一个手机用户并绑定手机用户密码的验证方法
  		var mobile_userpwdObj = new Object();
     	mobile_userpwdObj.inputID = 'pwd_mobile2_form';
    	mobile_userpwdObj.messageID = 'message_mobile2_form';
 		$("#pwd_mobile2_form").bind("blur",mobile_userpwdObj,pwdCheck ); 
       
   		//new一个mvp卡用户并绑定消费卡用户密码的验证方法
		var userCarPwdObj = new Object();
  		userCarPwdObj.inputID = 'password_card_form';
		userCarPwdObj.messageID = 'password_card_message';
		$("#password_card_form").bind("blur",userCarPwdObj,pwdCheck );
       
      	//普通用户确认密码的验证 
     	//new一个线下卡用户密码的验证方法
       var offuserCarPwdObj = new Object();
       offuserCarPwdObj.inputID = 'password_offline_card';
       offuserCarPwdObj.messageID = 'password_offline_card_message';
       $("#password_offline_card").bind("blur",offuserCarPwdObj,pwdCheck );
       
       
     	//普通用户确认密码的验证 
       $("#rpassword").blur( function(){
			if($('#rpassword').val()!=$('#password').val()){
       		showMessage("rpwd_message","两次密码不相同",'red');
         		validrpwd = false;
         		return false;   
      		}
             
   			validrpwd = true;
     		showMessage("rpwd_message","",'green');
     		return true; 
		});
     	
     	//手机用户确认密码的验证
		$("#rpwd_mobile2_form").blur(function(){
    		if($('#rpwd_mobile2_form').val()!=$('#pwd_mobile2_form').val()){
        		showMessage("rmessage_mobile2_form","两次密码不相同",'red');
           	validrpwd = false;
          		return false;   
       	} else {
          		showMessage("rmessage_mobile2_form","",'green');
         		validrpwd = true;
          		return true; 
         	}
    	}); 
     	
		// 邀请人手机号码验证
	  	var invitationMobileCheck = true;
	  	$("#invitationMobile").blur(function (){
        	if($('#invitationMobile').val().length > 0 && 
        			($('#invitationMobile').val().length!=11 || !/^1[3|4|5|7|8|9][0-9]+\d{4,8}$/.test($('#invitationMobile').val()))){
            	showMessage("invitationMobile_messsage","手机号码不合法！",'red');
            	invitationMobileCheck = false;
        		return false;
       		} else {
       			showMessage("invitationMobile_messsage","",'green');
       			invitationMobileCheck = true;
       			return true;
       		}
	  	});
              
		//消费卡用户确认密码的验证
       	$("#rpassword_card_form").blur(function(){
       		if($('#rpassword_card_form').val()!=$('#password_card_form').val()){
          		showMessage("rpassword_card_message","两次密码不相同",'red');
            	validrpwd = false;
          		return false;   
         	} else {
           		showMessage("rpassword_card_message","",'green');
           		validrpwd = true;
            	return true; 
    		}
  		});
         
       //线下卡用户确认密码的验证
       $("#rpassword_offline_card").blur(function(){
       		if($('#rpassword_offline_card').val()!=$('#password_offline_card').val()){
            	showMessage("rpassword_offline_card_message","两次密码不相同",'red');
           		validrpwd = false;
           		return false;   
     		} else {
          		showMessage("rpassword_offline_card_message","",'green');
           		validrpwd = true;
            	return true; 
        	}
		});
        
        //mvp卡密码的验证
        var validCarPwd = false;
        
        $("#mvpPwd").blur(function(){
           if(($('#mvpPwd').val() == "" || $('#mvpPwd').val().length == 0) && validmvpCard) {
           
              showMessage("pwd_card_message","请输入你的mvp卡密码！",'red');
              validCarPwd = false;
              return false;
           }else if(validmvpCard){
             $.ajax({
				   type: "POST",
				   url: "/CASServer/custom/checkMvpPwdAjax.do",
				    data: {mvpNo : $('#mvpCard').val(),mvpPwd : $('#mvpPwd').val()},
				   success: function(msg){
				    var obj = eval("("+msg+")");
				    if(obj.isOk == false){
				    	showMessage("pwd_card_message",obj.message,'red');
				    	validCarPwd = false;
				       return false;
				    }else{
				    	showMessage("pwd_card_message","","green");
				    	validCarPwd = true;
				    	return true;
				    }
				  }   
			 });  
			 }
        });
     
         //普通用户邮箱的验证
         var emailFun = function(){
        	   var vkey=$('#vKey').val();
        	   var vValue=$('#vValue').val();
               if($('#email').val().length==0||$('#email').val()==""){
                  showMessage("email_message","邮箱不能为空",'red');
                  validEmail = false;
                  return false; 
               }
               if(!/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/.test($('#email').val())){
                 showMessage("email_message","邮箱格式不正确",'red');
                    validEmail = false;
                 	return false; 
              }
              $.ajax({
				   type: "POST",
				   url: "/CASServer/custom/checkEmailUniqueAjax.do",
				   data: "email="+$('#email').val()+"&"+vkey+"="+vValue,
				   success: function(msg){
				    var obj = eval("("+msg+")");
				    if(obj.isOk == false){
				    	showMessage("email_message",obj.message,'red');
				    	validEmail = false;
				       return false;
				    }else{
				    	showMessage("email_message","","green");
				    	validEmail = true;
				    	$('#vKey').attr("value",obj.CASCheckKey);
				    	$('#vValue').attr("value",obj.CASCheckVale);
				    	return true;
				    }…